package cc.wsyw126.java.lambda;

import java.util.Arrays;
import java.util.List;

/**
 * Created by junpeng.yang on 16/8/24.
 */
public class JavaMap {
    public static void main(String[] args) {
        List<Integer> costBeforeTax = Arrays.asList(100, 200, 300, 400, 500);
        for (Integer cost : costBeforeTax) {
            double price = cost + .12*cost;
            System.out.println(price);
        }
        System.out.println("--------------------------");
        // With Lambda expression:
        costBeforeTax.stream().map((cost) -> cost + .12*cost)
                .forEach(System.out::println);


        System.out.println("--------------------------");
        costBeforeTax.stream().forEach(n-> System.out.println(n + .12*n));
    }
}
